<template>
    <div>
        <div class="readHistory">
            <div class="readHistoryContainer">
                <span class="iconfont icon-zuojiantou" @click="$router.go(-1)"></span>
                <div><p>阅读历史</p></div>
            </div>
        </div>
        <div class="WatchTheHistoryBox">
            <div class="readHistoryContainer">
                <ul>
                    <li v-for="item in simplelist" :key="item.bookId">
                    <!-- <router-link v-for="item in simplelist" :key="item.bookId" tag="li" :to="'/TheWorkDetails?id='+item.bookId"> -->
                        <div class="WTHB_Img">
                            <img :src="item.cover" alt="">
                        </div>
                        <div class="WTHB_Content">
                            <div class="WTHBC_text">
                                <p class="WTHBCT_name">{{item.title}}</p>
                                <!-- <p class="WTHBCT_place">第800章 卑鄙</p> -->
                                <p class="WTHBCT_time">浏览时间: 今天</p>
                            </div>
                            <!-- <div class="WTHBC_Btn open"> -->
                            <router-link tag="div" :to="'/ReadThePage?id='+item.bookId" class="WTHBC_Btn open">
                                <span>打开</span>
                            </router-link>
                            <!-- </div> -->
                            <!-- <div class="WTHBC_Btn addition">
                                <span>加入书架</span>
                            </div> -->
                        </div>
                    <!-- </router-link> -->
                    </li>
                </ul>
            </div>
        </div>
    </div>
</template>

<script>
import { getbookGetsub,getBookInfo } from  "../api/TheWorkDetails";
export default {
    data(){
        return{
            moreShow:false,
            signIn:false,
            complexlist:[], // 详情接口
            simplelist:[], // 简单接口
        }
    },
    methods:{
        // 书籍详情接口
        getbookGetsubFun(id){
            getbookGetsub({id:id}).then(data=>{
                this.complexlist.push(data.feed)
            })
        },
        // 书籍简单详情
        getBookInfoFun(id){
            getBookInfo({sourceUuid:id}).then(data=>{
                this.simplelist.push(data.data.book)
            })
        },
        // 获取信息
        getInFoData(){
            for(let i = 0 ; i < this.$store.state.bookHistoryList.length ; i++){
                this.getbookGetsubFun(this.$store.state.bookHistoryList[i]);
                this.getBookInfoFun(this.$store.state.bookHistoryList[i]);
            }
            console.log("详情",this.complexlist);
            console.log("简单",this.simplelist)
        }
    },
    created(){
        this.getInFoData();
        console.log(this.$store.state.bookHistoryList)
    }
}
</script>

<style lang="less">
.readHistoryContainer{
  width: 92%;
  margin: 0px auto;
}
.readHistory{
    background-color: #ffda33;
    position: fixed;
    left: 0px;
    top: 0px;
    width: 100%;
    .readHistoryContainer{
        position: relative;
        text-align: center;
        padding: 12px 0px;
        span{
            position: absolute;
            left: 0px;
            top: 12px;
            font-size: 24px;
            font-weight: bold;
        }
        div{
            p{
                font-size: 20px;
                font-weight: bold;
                line-height: 26px;
            }
        }
    }
}
.WatchTheHistoryBox{
    padding-top: 60px;
    background-color: #fff;
    padding-bottom: 10px;
    ul{
        li{
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 10px 0px;
            .WTHB_Img{
                width: 60px;
                height: 80px;
                background-color: pink;
                img{
                    width: 100%;
                    height: 100%;
                }
            }
            .WTHB_Content{
                width: 80%;
                display: flex;
                justify-content: space-between;
                align-items: center;
                .WTHBC_text{
                    width: 65%;
                    .WTHBCT_name{
                        font-size: 18px;
                        font-weight: bold;
                        color: #333;
                        margin-bottom: 5px;
                    }
                    p{
                        font-size: 14px;
                        color: #aaa;
                        line-height: 24px;
                    }
                }
                .WTHBC_Btn.open{
                    padding: 6px 30px;
                    border: 1px solid #ccc;
                    border-radius: 20px;
                    font-size: 14px;
                    color: #333;
                }
                .WTHBC_Btn.addition{
                    padding: 6px 15px;
                    border: 1px solid #ffda33;
                    border-radius: 20px;
                    font-size: 14px;
                    color: #ffda33;
                }
            }
        }
    }
}
</style>